<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>

<body>
<div id="a1"></div>
<script type="text/javascript" src="./ckplayer/ckplayer.js" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8" src="./ckplayer/bcloud_hack.js"></script>
<script id="autoJs3996dd1d1f" type="text/javascript">

    var player = new CloudVodPlayer();
    player.init({
        "containerId": "a1",
        "uu": "4v9kgtlb6v",
        "vu": "4b2ee43c8d",
        "lang": "zh_CN",
        "callback": function (elementId, videoSetting) {

            var mediaInfos = videoSetting.media, definition = videoSetting.defaultDefinition;

            var mediaItemInfo = {}, mediaUrl, videoType;
            var sdic = Object.keys(mediaInfos).sort().reverse();
            for (ki in sdic) {
                mediaItemInfo = mediaInfos[sdic[ki]];
                break;
            }
            if (!mediaItemInfo) {
                mediaItemInfo = mediaInfos[definition];
            }
            mediaUrl = mediaItemInfo.urls[mediaItemInfo.urls.length - 1];
            videoType = mediaItemInfo.videoType;

            var flashvars = {
                f: mediaUrl,
                c: 0,
                calljs: 'playerstop',
                loaded: 'loadedHandler',
                my_url: encodeURIComponent(window.location.href)
            };
            var video = [mediaUrl];
            window.ckplayerId = "ckplayer_" + elementId;
            CKobject.embed('ckplayer/ckplayer.swf', elementId, window.ckplayerId, '100%', 600, false, flashvars, video);

        }
    }, {}, {});


    var watchTime = 0;
    var setT = null;

    function playerstop() {
        console.log(watchTime);
    }
    function loadedHandler() {
        if (CKobject.getObjectById(window.ckplayerId).getType()) {
            CKobject.getObjectById(window.ckplayerId).addListener('paused', pausedHandler);
        }
        else {
            CKobject.getObjectById(window.ckplayerId).addListener('paused', 'pausedHandler');
        }
    }
    function pausedHandler(b) {
        if (setT) {
            window.clearInterval(setT);
        }
        if (!b) {
            setT = window.setInterval(setFunction, 1000);
        }
    }
    function setFunction() {
        watchTime += 1;
    }

</script>
</body>
</html>